module.exports = function ($scope, $resource,spot_code,flag, $state,$modalInstance, $http, toaster) {
  var spot_code = flag ? {'flag': true} : spot_code;
  console.log(spot_code)
  $scope.flag = '0';
  $scope.obj = {};
if(spot_code !== undefined){
  $scope.flag = '1'
  $resource('/api/as/ggc/facediscerndao/getFDspotBycode', {}, {}).save({'spot_code':spot_code},function (res) {
    if (res.errcode !== 0) {
      alert("数据获取失败");
      return;
    }
    $scope.obj = res.data;
  })
}


$resource('/api/as/ggc/facediscerndao/findFDeqstartList', {}, {}).save({'create_by':$scope.info.bind_seller_login_code},function (res) {
  if (res.errcode !== 0) {
    alert("数据获取失败");
    return;
  }
  $scope.steq = res.data;
})

$resource('/api/as/ggc/facediscerndao/findFDeqendList', {}, {}).save({'create_by':$scope.info.bind_seller_login_code},function (res) {
  if (res.errcode !== 0) {
    alert("数据获取失败");
    return;
  }
  $scope.edeq = res.data;
})



console.log($scope.info);
  $scope.cancel = function () {
    $modalInstance.dismiss('cancel');
  };
  $scope.ok = function () {
      // 插入我的表里
      $scope.obj.create_by = $scope.info.bind_seller_login_code;
      $resource('/api/ac/ggc/faceDiscernService/createFDspot', {}, {}).save($scope.obj,function (res) {
        if (res.errcode !== 0) {
          alert("更新失败");
          return;
        }
        $modalInstance.close();
      });
  };

  $scope.update = function () {
    // 插入我的表里
    $resource('/api/as/ggc/facediscerndao/updateFDspotBycode', {}, {}).save($scope.obj,function (res) {
      if (res.errcode !== 0) {
        alert(res.errmsg);
        return;
      }
      $modalInstance.close();
    });
};
}